Skip to content

Standardize scalar function array construction - #9135

Draft
connortsui20 wants to merge 1 commit into
developfrom
ct/scalar-fn-factory-ext
Draft

Standardize scalar function array construction#9135
connortsui20 wants to merge 1 commit into
developfrom
ct/scalar-fn-factory-ext

Conversation

@connortsui20

@connortsui20 connortsui20 commented Aug 1, 2026

Copy link
Copy Markdown
Member

(semi-related) Tracking Issue: #9129

Right now the tensor and geo scalar functions maintain bespoke inherent constructors alongside ScalarFnFactoryExt::try_new_array. This removes the redundant constructors and migrates the in-tree callers to the shared factory API.

Note that this intentionally removes public new() and try_new_array(...) methods from CosineSimilarity, InnerProduct, and L2Norm, plus try_new_array(...) from the four geo scalar functions. This is a source compatibility break, which is why I split it out from the RowFn work and left the PR as a draft. The main review question is whether the smaller and consistent API is worth that break, or whether these should remain as forwarding methods.

Normalized used to be the awkward exception here: its constructors enforce or explicitly bypass the normalized-row invariant, which the generic factory cannot express. That turned out to be a sign it was never a scalar function in the first place, so it moves to a dedicated array encoding in #9138 and is no longer part of this diff.

@connortsui20

Copy link
Copy Markdown
Member Author

Still need to figure out if there is a way to make the generic factor ext trait able to express more complicated validation logic as in L2Denorm::try_new_array

@connortsui20 connortsui20 added the changelog/break A breaking API change label Aug 1, 2026
@connortsui20
connortsui20 force-pushed the ct/scalar-fn-factory-ext branch from 48d2bcc to ce52f49 Compare August 2, 2026 00:53
@connortsui20
connortsui20 force-pushed the ct/scalar-fn-factory-ext branch from ce52f49 to bf43ecf Compare August 2, 2026 18:03
@connortsui20
connortsui20 changed the base branch from develop to ct/l2-denorm-encoding August 3, 2026 15:14
@connortsui20
connortsui20 force-pushed the ct/l2-denorm-encoding branch 3 times, most recently from 8598018 to 780d4d0 Compare August 3, 2026 15:42
@connortsui20
connortsui20 force-pushed the ct/scalar-fn-factory-ext branch from bf43ecf to 8f10bf2 Compare August 3, 2026 15:57
@connortsui20
connortsui20 marked this pull request as ready for review August 3, 2026 16:53

@gatesn gatesn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GeoContains.try_new_array(bbox.len(), EmptyOptions, [bbox, points])?;

This is strictly worse than GeoContains::try_new_array(...)

@connortsui20

Copy link
Copy Markdown
Member Author

Ok so it seems like we need to delete the scalar function factory ext

@connortsui20
connortsui20 force-pushed the ct/scalar-fn-factory-ext branch from 8f10bf2 to 0a92c58 Compare August 3, 2026 19:56
Uses `ScalarFnFactoryExt` for tensor and geo scalar functions instead of maintaining per-function constructors. `L2Denorm` keeps its checked constructor because it validates the normalized-row invariant.

Signed-off-by: "Connor Tsui" <connor.tsui20@gmail.com>
@connortsui20
connortsui20 force-pushed the ct/scalar-fn-factory-ext branch from 0a92c58 to 4363c00 Compare August 3, 2026 20:35
@connortsui20
connortsui20 changed the base branch from ct/l2-denorm-encoding to develop August 3, 2026 20:37
@connortsui20
connortsui20 marked this pull request as draft August 3, 2026 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/break A breaking API change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants